package org.codehaus.mojo.wagon;

import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.WagonException;
import org.codehaus.mojo.wagon.shared.MavenRepoMerger;

import java.io.IOException;

/**
 * Merge artifacts from one Maven repository to another Maven repository.
 */
@Mojo(name = "merge-maven-repos", requiresProject = false)
public class MergeMavenRepoMojo extends AbstractCopyMojo {

    @Component
    private MavenRepoMerger mavenRepoMerger;

    @Override
    protected void copy(Wagon srcWagon, Wagon targetWagon) throws IOException, WagonException {
        mavenRepoMerger.merge(srcWagon, targetWagon, optimize, this.getLog());
    }

}